<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>接受服务通知</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../../css/mui.min.css">
		<link rel="stylesheet" href="../../../css/global.css">
		<link rel="stylesheet" href="../../../css/style.css">
		<style type="text/css">
			.inline-block {
				color: #5d5d5d;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">接受服务通知</h1>
		</header>
		<div class="mui-content">
			<div class="details_con">
				<div class="clum">
					<span class="name">服务编号</span>
					<span class="txt" id="serviceNo"></span>
				</div>
				<div class="clum">
					<span class="name">提交时间</span>
					<span class="txt" id="createTime"></span>
				</div>
				<div class="clum">
					<span class="name">服务子类型</span>
					<span class="txt" id="serviceType"></span>
				</div>
				<div class="clum_arr">
					<span class="name_arr">客户名称</span>
					<span class="txt_arr" id="customerName"></span>
				</div>
				<div class="clum">
					<span class="name">客户类型</span>
					<span class="txt" id="enginnerType"></span>
				</div>
				<div class="clum">
					<span class="name">期望服务时间</span>
					<span class="txt" id="hopeBusinessHours"></span>
				</div>
				<div class="clum">
					<span class="name">服务角色</span>
					<span class="txt">
						<input class="serviceRole" name="serviceRole" type="radio" value="1" checked="checked">现场服务
						<input class="serviceRole" name="serviceRole" type="radio" value="2" >实习
					</span>
				</div>
				<div class="my-content-cell">
					<div class="inline-block" id="khxxxx">
						<em>客户详细信息</em>
						<span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
					</div>
				</div>
				<div class="my-content-cell">
					<div class="inline-block" id="yqxx">
						<em>仪器详细信息</em>
						<span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
					</div>
				</div>
				<div class="my-content-cell">
					<div class="inline-block" id="htxx">
						<em>合同详细信息</em>
						<span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
					</div>
				</div>
				<div class="my-content-cell">
					<div class="inline-block" id="fwtzxx">
						<em>服务通知详细信息</em>
						<span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
					</div>
				</div>
				<div class="my-content-cell">
					<div class="inline-block" id="tjsybjxx">
						<em>推荐使用备件详细信息</em>
						<span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
					</div>
				</div>
			</div>
			<div class="btn_box">
				
				<span class="fl" id="jujue">拒绝</span>
				<span class="fr red" id="jieshou">接受</span>
			</div>
			<div style="height: 50px;"></div>
		</div>

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			(function($, doc) {
				$.init();

				var ServiceNoticeId
				var serviceNo
				var planId
				
				// 仪器详情用带过去
				var trainQuota
				var installationDate
				var cfda
				
				// 服务通知详细信息用
				var serviceType
			    var isWarranty
			    var troubleDescription
			    var remark
		
				$.plusReady(function() {

					console.log(plus.webview.getTopWebview())
					// 从上一个页面取值
					var self = plus.webview.currentWebview();
					 // 获取上一个页面传过来的参数并显示到页面
					 ServiceNoticeId = self.ServiceNoticeId;
					 serviceNo = self.serviceNo;
					 planId = self.planId;
					 
					 console.log("ServiceNoticeId:"+ServiceNoticeId+"	serviceNo:"+serviceNo+"	planId:"+planId)
					 
					 // 获取详情的方法
					 getDetails();
					 
					 // 客户详细信息
					 h("#khxxxx").tap(function(){
						 app.jumpTo("/view/service/accept/customerDetails.html", "view/service/accept/customerDetails.html",
						 {
						 	ServiceNoticeId:ServiceNoticeId,
						 	serviceNo: serviceNo,
						 	planId: planId
						 });
					 })
					 
					 // 仪器详细信息
					 h("#yqxx").tap(function(){
						 app.jumpTo("/view/service/accept/instrumentDetails.html", "view/service/accept/instrumentDetails.html",
						 {
						 	ServiceNoticeId:ServiceNoticeId,
						 	serviceNo: serviceNo,
						 	planId: planId,
							trainQuota: trainQuota,
							installationDate: installationDate,
							cfda: cfda
						 });
					 })
					 
					 // 合同详细信息
					 h("#htxx").tap(function(){
						 // app.toast("暂未开放");
						 app.jumpTo("/view/service/accept/contractDetails.html", "view/service/accept/contractDetails.html",{
						 	serviceNo: serviceNo,
						 });
					 })
					 
					 // 服务通知详细信息
					 h("#fwtzxx").tap(function(){
						 app.jumpTo("/view/service/accept/noticeDetails.html", "view/service/accept/noticeDetails.html",
						 {
						 	ServiceNoticeId:ServiceNoticeId,
						 	serviceNo: serviceNo,
						 	planId: planId,
							serviceType: serviceType,
							isWarranty: isWarranty,
							troubleDescription: troubleDescription,
							remark: remark
						 });
					 })
					 
					 // 推荐使用备件详细信息
					 h("#tjsybjxx").tap(function(){
						 app.jumpTo("/view/service/accept/partDetails.html", "view/service/accept/partDetails.html",
						 {
						 	ServiceNoticeId:ServiceNoticeId,
						 	serviceNo: serviceNo,
						 	planId: planId
						 });
					 })
					 
				});
				
				// 获取详情的方法
				function getDetails(){
					app.showWaiting('加载中...')
					ajaxGet(BASE_URL + "cc/notice/getMyServiceNoticeDetail", {
						"ServiceNoticeId": ServiceNoticeId,
						"EnginnerId": app.getUser().enginnerId
					}, function(data) {
						app.closeWaiting()
						console.log(JSON.stringify(data))
						if (data.code == 200) {
							if(data.data!=""){
								h("#serviceNo").html(data.data[0].serviceNo);
								h("#createTime").html(data.data[0].createTime);
								h("#serviceType").html(data.data[0].subServiceType);
								h("#customerName").html(data.data[0].customerName);
								if(data.data[0].enginnerType==undefined || data.data[0].enginnerType==""){
									h("#enginnerType").html("无");
								}else{
									h("#enginnerType").html(data.data[0].enginnerType);
								}
								if(data.data[0].hopeBusinessHours==undefined || data.data[0].hopeBusinessHours==""){
									h("#hopeBusinessHours").html("无");
								}else{
									h("#hopeBusinessHours").html(data.data[0].hopeBusinessHours);
								}
								
								// 仪器详细信息页面用
								if(data.data[0].trainQuota==undefined || data.data[0].trainQuota==""){
									trainQuota = "";
								}else{
									trainQuota = data.data[0].trainQuota;
								}
								if(data.data[0].installationDate==undefined || data.data[0].installationDate==""){
									installationDate = "";
								}else{
									installationDate = data.data[0].installationDate;
								}
								if(data.data[0].cfda==undefined || data.data[0].cfda==""){
									cfda = "";
								}else{
									cfda = data.data[0].cfda;
								}
								
								// 服务通知详细信息页面用
								if(data.data[0].serviceType==undefined || data.data[0].serviceType==""){
									serviceType = "";
								}else{
									serviceType = data.data[0].serviceType;
								}
								if(data.data[0].isWarranty==undefined || data.data[0].isWarranty==""){
									isWarranty = "";
								}else{
									isWarranty = data.data[0].isWarranty;
								}
								if(data.data[0].troubleDescription==undefined || data.data[0].troubleDescription==""){
									troubleDescription = "";
								}else{
									troubleDescription = data.data[0].troubleDescription;
								}
								if(data.data[0].remark==undefined || data.data[0].remark==""){
									remark = "";
								}else{
									remark = data.data[0].remark;
								}
							
								
							}

						}
					}, function(errorMsg) {
						app.closeWaiting()
						console.log(JSON.stringify(errorMsg))
						app.toast(JSON.stringify(errorMsg))
					});
				}
				
				// 接受方法
				h("#jieshou").tap(function(){
					var serviceRole;
					var ele = document.getElementsByName("serviceRole");
					for (var i = 0; i < ele.length; i++) {	
						if(ele[i].checked){
							serviceRole = ele[i].value
							break
						}
					}
					app.jumpTo("/view/service/accept/expectedDoor.html", "view/service/accept/expectedDoor.html",
					{
						ServiceNoticeId:ServiceNoticeId,
						serviceNo: serviceNo,
						planId: planId,
						serviceRole: serviceRole
					});
				})
				
				// 拒绝方法
				h("#jujue").tap(function(){
					app.jumpTo("/view/service/refuse/refuse.html", "view/service/refuse/refuse.html",
					{
						ServiceNoticeId:ServiceNoticeId,
						serviceNo: serviceNo,
						planId: planId
					});
				})
				
			}(mui, document));
		</script>
		<!-- js代码 end -->

	</body>

</html>
